import { IParam, EntityBase } from '@/core';
import { IUser2 } from './interface/i-user-2';
import User2Keys from './user-2-keys';

/**
 * 用户2基类
 * 基于template/src/api/{{appEntities}}/{{appEntities}}-base.ts.hbs生成
 *
 * @export
 * @abstract
 * @class User2Base
 * @extends { EntityBase }
 * @implements { IUser2 }
 */
export abstract class User2Base extends EntityBase implements IUser2 {
	/**
	 * 实体名称
	 *
	 * @readonly
	 * @type {string}
	 * @memberof User2Base
	 */
	get srfdename(): string {
		return 'USER2';
	}

	/**
	 * 当前实体所有属性
	 *
	 * @protected
	 * @type {string[]}
	 * @memberof User2Base
	 */
	protected get keys(): string[] {
		return User2Keys;
	}

	/**
	 * Creates an instance of ConstactOppoBase.
	 * @param {*} [data]
	 * @memberof User2Base
	 */
	constructor(data?: any) {
		super();
		this.setData(data);
	}

	get srfkey(): string {
		return this.id;
	}

	set srfkey(val: string) {
		this.id = val;
	}

	/**
	 * 标识
	 **/
	id?: any;

	/**
	 * 逻辑有效标记
	 **/
	enabled?: any;

	/**
	 * 创建人
	 **/
	creator?: any;

	/**
	 * 创建时间
	 **/
	create_time?: any;

	/**
	 * DC
	 **/
	dc?: any;

	/**
	 * 最后更新人
	 **/
	updater?: any;

	/**
	 * 最后更新时间
	 **/
	update_time?: any;

	/**
	 * 密码
	 **/
	pwd?: any;

	get srfmajortext(): string {
		return this.user2name;
	}

	set srfmajortext(val: string) {
		this.user2name = val;
	}
	/**
	 * 用户2名称
	 **/
	user2name?: any;

	/**
	 * 重置实体数据
	 *
	 * @param {IParam} [data={}]
	 * @memberof User2Base
	 */
	reset(data: IParam = {}): void {
		super.reset(data);
		this.id = data.id || data.srfkey;
		this.user2name = data.user2name || data.srfmajortext;
	}
}
